//
//  MusicSongRecommendCVC.m
//  YHYRealx
//
//  Created by yanghuiyan on 16/4/27.
//  Copyright © 2016年 yanghuiyan. All rights reserved.
//

#import "MusicSongRecommendCVC.h"

@implementation MusicSongRecommendCVC

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.backgroundColor = [UIColor colorWithRed:0.00 green:0.20 blue:0.35 alpha:1.00];
        
//        self.bacView = [YHYBaseView new];
//        self.bacView.backgroundColor = [UIColor grayColor];
//        self.bacView.alpha = 0.5;
//        [self.contentView addSubview:self.bacView];
        
        self.labelTitle = [YHYBaseLabel new];
        self.labelTitle.font = [UIFont systemFontOfSize:15];
        self.labelTitle.textColor = [UIColor colorWithRed:0.88 green:0.88 blue:0.89 alpha:1.00];
        [self.contentView addSubview:self.labelTitle];
        
        self.labelDetail = [YHYBaseLabel new];
        self.labelDetail.textColor = [UIColor colorWithRed:0.57 green:0.59 blue:0.62 alpha:1.00];
        self.labelDetail.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:self.labelDetail];
        
        self.buttonPlay = [UIButton buttonWithType:UIButtonTypeSystem];
        _buttonPlay.frame = CGRectZero;
        [_buttonPlay addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
        [_buttonPlay setImage:[[UIImage imageNamed:@"音乐播放"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
        [self.contentView addSubview:_buttonPlay];
        
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [_labelTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).offset(22);
        make.left.equalTo(self.contentView).offset(20);
        make.width.mas_equalTo(self.contentView.frame.size.width * 0.5);
        make.height.equalTo(@20);
        
    }];

    [_labelDetail mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_labelTitle.mas_bottom).offset(10);
        make.left.equalTo(self.contentView).offset(20);
        make.width.mas_equalTo(self.contentView.frame.size.width *0.7);
        make.height.equalTo(@20);
        
    }];
    
    [_buttonPlay mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.right.equalTo(self.contentView).offset(-20);
        make.size.mas_equalTo(CGSizeMake(25, 25));
        
    }];
}

- (void)buttonAction:(UIButton *)sender {
    
}

- (void)setDetailModel:(MusicDetailDataModel *)detailModel {
    if (_detailModel != detailModel) {
        [_detailModel release];
        [_detailModel retain];
    }
    _labelTitle.text = detailModel.name;
    _labelDetail.text = detailModel.desc;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
